package dyyx.util;

import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

public class ColumnInfo {
	
	public final String columnName;
	public final String columnLabel;

	public final int columnType;
	public final String columnTypeName;
	
	

	public ColumnInfo(ResultSetMetaData rsmd,int index)throws SQLException{	
		// to lowercase ?
		this.columnName = rsmd.getColumnName(index);
		this.columnLabel = rsmd.getColumnLabel(index);
		this.columnType = rsmd.getColumnType(index);
		this.columnTypeName = rsmd.getColumnTypeName(index);
			
	}
		
	
	@Override
	public String toString(){	
		Map<String,Object> map = new HashMap<String,Object>();		
		map.put("columnName", columnName);
		map.put("columnLabel", columnLabel);
		map.put("columnType", columnType);
		map.put("columnTypeName", columnTypeName);
		
		return map.toString();
	}
	
}
